<template>
    <div></div>
</template>

<script>
export default {
    name: "middlepage",
    data() {
        return {
            timestamp: "",
            userId: "",
            productId: "",
            redirectUrl: ""
        };
    },
    methods: {
    
    },
    mounted() {
        this.timestamp = Date.parse(new Date());
        this.userId = this.$route.query.userId;
        this.productId = this.$route.query.productId;
        this.redirectUrl = this.$route.query.redirectUrl;

        this.axios({
            method: "post",
            url: `${
                this.siteUrl
            }/app/record/product/doRecord?appid=web.2019&format=json&timestamp=${
                this.timestamp
            }`,
            data: {
                userId: Number(this.userId),
                productId: Number(this.promoteId)
            }
        })
            .then(response => {
                console.log(response);
                if (response.data.success == 1) {
                    window.location.href = this.redirectUrl;
                } else {
                    window.location.href = this.redirectUrl;
                }
            })
            .catch(error => {
                console.log(error);
                this.$toast("连接服务器异常");
            });
    }
};
</script>


